package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class MovieInfo extends MenuList{
    private String menuName = "Movie List";
    private File dataFile = new File("src/com/twu/biblioteca/movie.txt"); // default file path

    public boolean execute() throws IOException {
        BufferedReader fileReader = new BufferedReader(new FileReader(dataFile));
        String dataLine;

        while((dataLine = fileReader.readLine())!=null) {
            String[] movieData = dataLine.split(" ");
            System.out.printf("\n%30s%6s%30s%10s\n",movieData[0].replace("_"," "),movieData[1],movieData[2],movieData[3]);
        }
        System.out.println("\n---\nEnd of the list");

        return true;
    }

    public String getMenuName() {
        return menuName;
    }
}
